{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from tldraw import TldrawImage\n",
    "TldrawImage()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "from pathlib import Path\n",
    "\n",
    "import base64\n",
    "\n",
    "# Assuming the images are now in the 'image_assets' folder and the path is correct\n",
    "image_files = list(Path(\"image_assets\").glob(\"*\"))\n",
    "\n",
    "# Read all images into base64 strings\n",
    "base64_images = {}\n",
    "for image_path in image_files:\n",
    "    with open(image_path, \"rb\") as image_file:\n",
    "        base64_img_string_raw = base64.b64encode(image_file.read()).decode(\"utf-8\")\n",
    "        base64_images[\n",
    "            image_path.name\n",
    "        ] = f\"data:image/png;base64,{base64_img_string_raw}\"\n",
    "\n",
    "from tldraw import TldrawImageArray\n",
    "\n",
    "t = TldrawImageArray(base64img=base64_images[\"im1.png\"])\n",
    "display(t)\n",
    "\n",
    "import time\n",
    "\n",
    "for img in base64_images.values():\n",
    "    t.base64img = img\n",
    "    time.sleep(0.8)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
